public class TestDemo {
        String str = new String("good");
        char[ ] ch = { 'a' , 'b' , 'c' };
        public static void main(String args[]){
            TestDemo ex = new TestDemo();
            ex.change(ex.str,ex.ch);
            System.out.print(ex.str + " and ");
            System.out.print(ex.ch);
        }
        public void change(String str,char ch[ ]){
            str = "test ok";
            ch[0] = 'g';
        }
    public static void main_10(String[] args) {
        String str = " hello%$$%@#$%world 哈哈哈 " ;
        System.out.println(str.toUpperCase());
        System.out.println(str.toLowerCase());
    }
    public static void main_09(String[] args) {
        String str = " hello world " ;
        System.out.println("["+str+"]");
        System.out.println("["+str.trim()+"]");
    }
    public static void main_08(String[] args) {
        String str = "helloworld" ;
        System.out.println(str.substring(5));
        System.out.println(str.substring(0, 5));
    }
    public static void main_07(String[] args) {
        String str1 = "hello world hello bit" ;
        String[] result1 = str1.split(" ") ;
        for(String s: result1) {
            System.out.println(s);
        }
        String str2 = "hello world hello bit" ;
        String[] result2 = str2.split(" ",2) ;
        for(String s: result2) {
            System.out.println(s);
        }
    }
    public static void main_06(String[] args) {
        String str = "helloworld" ;
        System.out.println(str.replaceAll("l", "_"));
        System.out.println(str.replaceFirst("l", "_"));
    }
    public static void main_05(String[] args) {
        String s = "hello";
        char[] ch = s.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            System.out.print(ch[i]);
        }
        System.out.println();
        String s2 = new String(ch);
        System.out.println(s2);
    }
    public static void main_04(String[] args) {
        String s1 = "hello";
        String s2 = "HELLO";
        System.out.println(s1.toUpperCase());
        System.out.println(s2.toLowerCase());
    }
    public static void main_03(String[] args) {
        String s1 = String.valueOf(1234);
        String s2 = String.valueOf(12.34);
        String s3 = String.valueOf(true);
        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        int data1 = Integer.parseInt("1234");
        double data2 = Double.parseDouble("12.34");
        System.out.println(data1);
        System.out.println(data2);
    }
    public static void main_02(String[] args) {
        String s = "aaabbbcccaaabbbccc";
        System.out.println(s.charAt(3));
        System.out.println(s.indexOf('c'));
        System.out.println(s.indexOf('c', 10));
        System.out.println(s.indexOf("bbb"));
        System.out.println(s.indexOf("bbb", 10));
        System.out.println(s.lastIndexOf('c'));
        System.out.println(s.lastIndexOf('c', 10));
        System.out.println(s.lastIndexOf("bbb"));
        System.out.println(s.lastIndexOf("bbb", 10));
    }
    public static void main_01(String[] args) {
        String str1="hello";
        String str2="hello";
        System.out.println(str1==str2);
        String str3=new String("hello");
        System.out.println(str1==str3);
        System.out.println(str1.equals(str3));
        String str4=new String("hallo");
        System.out.println(str1.compareTo(str4));
        String str5=new String("HELLO");
        System.out.println(str1.compareToIgnoreCase(str5));
    }
}
